interface Room{
    TaskManager():void
    AddMisson(mis:MissionModel):boolean
    DeleteMisson(id:string):boolean
    CoolDownCaculator():void
    DelayCaculator():void
    UnbindMonitor():void
    MissonNum(range:string,name:string):number
    RoleMissonNum(role:string,name:string):number
    MarketMissonNum(rType:string,name:string):number
    GainMisson(id:string):MissionModel | null
    CheckLabType(id:string,rType:ResourceConstant):boolean
    CheckLabOcc(id:string):boolean
    BindLabData(id:string,rType:ResourceConstant,MissonID:string,occ?:boolean):boolean
    UnBindLabData(id:string,MissonID:string):boolean
    Check_Lab(misson:MissionModel,role:string,tankType:'storage' | 'terminal' | 'complex'):boolean
    Deal_Resource(rType:ResourceConstant,num:number,range:number,max:number):void
    Resource_Dispatch(rType:ResourceConstant,num:number):boolean
    TowerWork():void
    MakeOrder(marketType:'buy'|'sell',rType:ResourceConstant,num:number,price:number):boolean
    /* 具体任务 */
    Task_Carry(misson:MissionModel):void
    Task_Feed():void
    Task_Build():void
    Task_NTower():void
    Task_Clink():void
    Task_LabEnergy():void
    Task_OTower():void
    Task_Nuker():void
    Task_ComDispatch():void
    Task_monitorMineral():void
    Task_montitorPower():void
    Task_Auto_Defend():void
    Task_Com(misson:MissionModel):void
    Task_RushLevel(misson:MissionModel):void
    Task_Sign(misson:MissionModel):void
    Task_BoostHelpBuild(misson:MissionModel):void
    Task_HelpUpgrade(misson:MissionModel):void
    Task_HelpRear(misson:MissionModel):void
    Task_AIO(misson:MissionModel):void
    Task_Mineral(misson:MissionModel):void
    Task_CrossHarvest(misson:MissionModel):void
    Task_Double(misson:MissionModel):void
    Task_ProcessPower(misson:MissionModel):void
    Task_OutMine(misson:MissionModel):void
    Task_Repair(misson:MissionModel):void
    Task_Dismantle(misson:MissionModel):void
    Task_ClaimAttack(misson:MissionModel):void

    
    nuke_monitor():void
    // structure
    Task_SlinkToClink():void
    

    // 战争
    Task_X_CLASS_R(misson:MissionModel):void
    Task_Squard(misson:MissionModel):void
    Task_OvermindKiller(misson:MissionModel):void


    /* 发布便捷函数 */
    Public_Carry(creepData:BindData,delayTick:number,sR:string,sX:number,sY:number,tR:string,tX:number,tY:number,rType?:ResourceConstant,num?:number):MissionModel
    Public_Link(structure:string[],disStructure:string,level:number,delayTick?:number):MissionModel
    Public_Send(disRoom:string,rType:ResourceConstant,num:number):MissionModel
    Bind_Lab(rTypes:ResourceConstant[]):MissonLabBind | null
    Public_Com(num:number,disResource:ResourceConstant,bindData?:string[]):MissionModel
    Public_Buy(res:ResourceConstant,num:number,range:number,max?:number):MissionModel
    Public_level(CreepNum:number,rType:ResourceConstant,Nolab?:boolean):MissionModel
    Public_Sign(CreepNum:number,disRoom:string,shard:shardName,words:string):MissionModel
    Public_BoostBuild(disRoom:string,shard:shardName,buildNum:number,claimNum:number):MissionModel
    Public_HelpUpgrade(disRoom:string,shard:shardName,CreepNum:number):MissionModel
    Public_HelpRear(disRoom:string,shard:shardName,CreepNum:number,rType:ResourceConstant,time:number):MissionModel
    Publid_Aio(disRoom:string,shard:shardName,CreepNum:number,time:number,body?:number[]):MissionModel
    Public_XR(disRoom:string,shard:shardName):MissionModel
    public_PowerHarvest(disRoom:string,x:number,y:number,num:number):MissionModel
    public_DepositHarvest(disRoom:string,x:number,y:number,rType:DepositConstant):MissionModel
    Public_Double(disRoom:string,shard:shardName,CreepNum:number,cType:'dismantle' | 'attack'):MissionModel
    public_OutMine(sourceRoom:string,x:number,y:number,disRoom:string):MissionModel
    public_repair(Rtype:'global' | 'special' | 'nuker',num:number,boostType:number,vindicate:boolean):MissionModel
    public_defend(AttackNum:number,RangeNum:number,DoubleNum:number):MissionModel
    Public_Dismantle(disRoom:string,shard:shardName,CreepNum:number,time:number):MissionModel
    Public_OMKiller(disRoom:string,shard:shardName):MissionModel


}

interface RoomMemory{
    Misson:{[range:string]:MissionModel[]}  // 任务
    TerminalData?:TerminalData
    RoomLabBind?:RoomLabBind
    CompoundTheme?:{list?:ResourceConstant[],num?:number},
    ComDispatchData?:{res?:ResourceConstant,num?:number,dispatch_num?:number}[] // 去除了重复合成的缺点，高效便捷！！！！！
    mineralType?:ResourceConstant
    StopPower?:boolean  // 停止烧power
    nukeID?:string[]
    nukeData?:NukeData
}
interface NukeData{
    damage:{[str:string]:number}// 地形伤害数据
    rampart:{[str:string]:number}   // 初始rampart防御数据
}

interface Memory{
    outMineData:OutMineDict
}

interface OutMineDict{
    [index:string]:OutMineData
}

interface OutMineData{
    road:string[]       // 外矿房间的路位置数据 ['12/24/E49S43','34/12/E49S43',....,'23/43/E49S42']
    startpoint:string  // 外矿起始点 12/23/E49W43
    minepoint:{pos:string,bind:{harvest?:string,car?:string}}[]// 矿点位置，矿点绑定爬虫信息
    car?:boolean   // 是否派运输爬 默认不派出
}


/* 房间任务模板 */
interface MissionModel{
    /* 所有任务都必须有 */
    name:string     // 任务名称
    range: 'Room' | 'Creep' | 'Structure' | 'PowerCreep'    // 任务所属范围  新增powerCreep任务
    delayTick:number    // 过期时间
    structure?:string[] // 与任务有关的建筑id
    data?:any           // 任务携带数据
    state?:number       // 任务状态
    maxTime?:number     // 最大重复任务数
    LabBind?:MissonLabBind        // 实验室绑定
    cooldownTick?:number // 冷却时间
    CreepBind?:BindData  // 爬虫绑定
    level?:number        // 任务等级，越小优先级越高
    /* 自动处理属性 */
    processing?:boolean // 任务是否正在被处理
    id?:string       // 每个任务的唯一标识
}

/* 任务实验室绑定数据格式 */
interface MissonLabBind{
    [id:string]:string     // 建筑id 资源
}

/* 任务绑定 */
interface BindData{
    [role:string]:{num:number,bind:string[]}
}

/* 终端数据 */
interface TerminalData{
    [res:string]:{num:number,level:number,fill:boolean,send?:boolean,buy?:boolean}
}


/* 房间记忆实验室绑定数据格式 */
interface RoomLabBind{
    [id:string]:{missonID:string[],rType:ResourceConstant,occ?:boolean}     // occ为true时不允许新增占用lab
}

interface TowerData{
    roadList?:string[]
    towerRepairIndex?:number
    towerOccupy?:string // 防御塔是否被支配 被支配则不能进行维修等操作 值是支配者名字
    towerObjectList?:StructureTower[]
    enemyindex?:number
}

/* 挂载扩展所用模块 */
declare module NodeJS {
    // 全局对象
    interface Global {
        TowerData:{
            [roomName:string]:TowerData
        }
    }
}

